/**
 * @param {number} num
 * @param {number} k
 * @return {number}
 */
var minimumNumbers = function(num, k) {
  if(num == 0) return 0;
  if((k % 2 == 0 && num % 2 == 1)) return -1;
  if(num == k) return 1;
  if(k == 1) return num;
  if(k == 0) {
    if(num % 10 == 0) {
      return 1;
    } else {
      return -1;
    }
  }

  let tempK = k;
  while(tempK <= num - tempK) {
    let remain = num - tempK;
    if(remain % 10 == k) return 2;
    tempK += 10;
  }
  return -1
};
let num = 58, k = 9;
console.log(minimumNumbers(num, k));
num = 37, k = 2;
console.log(minimumNumbers(num, k));
num = 0, k = 7;
console.log(minimumNumbers(num, k));
num = 37, k = 2;
console.log(minimumNumbers(num, k));
num = 3, k = 3;
console.log(minimumNumbers(num, k));
num = 1, k = 1;
console.log(minimumNumbers(num, k));
num = 5, k = 1;
console.log(minimumNumbers(num, k));
num = 10, k = 5;
console.log(minimumNumbers(num, k));
num = 10, k = 0;
console.log(minimumNumbers(num, k));
